package com.wdb007.venus.svc.facade.constant;

import java.util.Map;
import java.util.TreeMap;

// generic data model for Action
public class Action {
    private Map<String,Object> _values;
    private String _action;  // for cache

    public static final String bookgrid_openuv_req       = "bookgrid_openuv_req";
    public static final String bookgrid_openuv_res       = "bookgrid_openuv_res";
    public static final String bookgrid_closeuv_req      = "bookgrid_closeuv_req";
    public static final String bookgrid_closeuv_res      = "bookgrid_closeuv_res";
    public static final String bookgrid_openled_req      = "bookgrid_openled_req";
    public static final String bookgrid_openled_res      = "bookgrid_openled_res";
    public static final String bookgrid_closeled_req     = "bookgrid_closeled_req";
    public static final String bookgrid_closeled_res     = "bookgrid_closeled_res";
    public static final String bookgrid_unlock_req       = "bookgrid_unlock_req";
    public static final String bookgrid_unlock_res       = "bookgrid_unlock_res";
    public static final String bookgrid_status_req       = "bookgrid_status_req";
    public static final String bookgrid_status_res       = "bookgrid_status_res";
    public static final String bookgrid_check_req        = "bookgrid_check_req";
    public static final String bookgrid_check_res        = "bookgrid_check_res";
    public static final String bookcase_check_req        = "bookcase_check_res";
    public static final String bookcase_check_res        = "bookcase_check_res";
    public static final String bookcase_unlock_req       = "bookcase_unlock_req";
    public static final String bookcase_unlock_res       = "bookcase_unlock_res";
    public static final String bookcase_status_req       = "bookcase_status_req";
    public static final String bookcase_status_res       = "bookcase_status_res";
    public static final String bookcase_check_fixed_res  = "bookcase_check_fixed_res";
    public static final String bookcase_status_fixed_res = "bookcase_status_fixed_res";
    public static final String policies_issued           = "policies_issued";
    public static final String bookcase_restart          = "bookcase_restart";
    public static final String policies_qrcode           = "policies_qrcode";

    public static Action bookgrid_openuv_req() {
        return new Action(bookgrid_openuv_req);
    }
    public static Action bookgrid_openuv_res() {
        return new Action(bookgrid_openuv_res);
    }
    public static Action bookgrid_closeuv_req() {
        return new Action(bookgrid_closeuv_req);
    }
    public static Action bookgrid_closeuv_res() {
        return new Action(bookgrid_closeuv_res);
    }
    public static Action bookgrid_openled_req() {
        return new Action(bookgrid_openled_req);
    }
    public static Action bookgrid_openled_res() {
        return new Action(bookgrid_openled_res);
    }
    public static Action bookgrid_closeled_req() {
        return new Action(bookgrid_closeled_req);
    }
    public static Action bookgrid_closeled_res() {
        return new Action(bookgrid_closeled_res);
    }
    public static Action bookgrid_unlock_req() {
        return new Action(bookgrid_unlock_req);
    }
    public static Action bookgrid_unlock_res() {
        return new Action(bookgrid_unlock_res);
    }
    public static Action bookgrid_status_req() {
        return new Action(bookgrid_status_req);
    }
    public static Action bookgrid_status_res() {
        return new Action(bookgrid_status_res);
    }
    public static Action bookgrid_check_req() {
        return new Action(bookgrid_check_req);
    }
    public static Action bookgrid_check_res() {
        return new Action(bookgrid_check_res);
    }
    public static Action bookcase_unlock_req() {
        return new Action(bookcase_unlock_req);
    }
    public static Action bookcase_unlock_res() {
        return new Action(bookcase_unlock_res);
    }
    public static Action bookcase_check_req() {
        return new Action(bookcase_check_req);
    }
    public static Action bookcase_check_res() {
        return new Action(bookcase_check_res);
    }
    public static Action bookcase_status_req() {
        return new Action(bookcase_status_req);
    }
    public static Action bookcase_status_res() {
        return new Action(bookcase_status_res);
    }
    public static Action bookcase_status_fixed_res() {
        return new Action(bookcase_status_fixed_res);
    }
    public static Action bookcase_check_fixed_res() {
        return new Action(bookcase_check_fixed_res);
    }
    public static Action policies_issued() {
        return new Action(policies_issued);
    }
    public static Action bookcase_restart() {
        return new Action(bookcase_restart);
    }
    public static Action policies_qrcode() {
        return new Action(policies_qrcode);
    }

    public Action() {
        _values = new TreeMap<>();
    }
    public Action(Map<String,Object> model) {
        _values = model;   // make reference
    }
    public Action(String action) {
        _values = new TreeMap<>();
        this.action(action);
    }
    public Map<String, Object> get() {
        return _values;
    }
    public String action() {
        return (String) _values.getOrDefault("action", null);
    }
    public Action action(String v) {
        _values.put("action", v);
        return this;
    }
    public String bookGridId() {
        return (String) _values.getOrDefault("bookGridId", null);
    }
    public Action bookGridId(String v) {
        _values.put("bookGridId", v);
        return this;
    }
    public String bookCaseId() {
        return (String) _values.getOrDefault("bookCaseId", null);
    }
    public Action bookCaseId(String v) {
        _values.put("bookCaseId", v);
        return this;
    }
    public Integer pushId() {
        return (Integer) _values.getOrDefault("pushId", null);
    }
    public Action pushId(Integer v) {
        _values.put("pushId", v);
        return this;
    }
    public Integer transactionId() {
        return (Integer) _values.getOrDefault("transactionId", null);
    }
    public Action transactionId(Integer v) {
        _values.put("transactionId", v);
        return this;
    }
    public boolean is(String action) {
        if (_action == null) {
            _action = this.action();
        }
        return (action.compareTo(_action) == 0);
    }
    public <T> T data() {
        return (T) _values.getOrDefault("data", null);
    }
    public String bookgridById(String id) {
        return (String) _values.getOrDefault(id, null);
    }
    public Action sid(String v) {
        _values.put("sid", v);
        return this;
    }
    public Action did(String v) {
        _values.put("did", v);
        return this;
    }
    public Action ts(Long v) {
        _values.put("ts", v);
        return this;
    }
    public String sid() {
        return (String) _values.getOrDefault("sid", null);
    }
    public String did() {
        return (String) _values.getOrDefault("did", null);
    }
    public Long ts() {
        return (Long) _values.getOrDefault("ts", null);
    }

    public Map<String,Object> values() {return this._values; }
}
